﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BallData
{
    class MathItem_CaiPiao
    {
        public String lotNumber;
        public String no;
        public String matchId;
        public Int64 matchTime;
        public String leagueId;
        public String leagueName;
        public String leagueNameTr;
        public String leagueNameEn;
        public String leagueColor;
        public String hostId;
        public String visitId;
        public String hostName;
        public String visitName;
        public String hostNameTr;
        public String visitNameTr;
        public String hostNameEn;
        public String visitNameEn;
        public String hostPos;
        public String visitPos;
        public String hostGoal;
        public String visitGoal;
        public String hand;
        public String wins;
        public String draws;
        public String losses;
        public String showOdds;
        public String showAnalysis;
        public String result;
        public String finalSp;
        public String isPause;
        public String isJian;
        public Int64 closeTime;
        public String gameType;
        public String anlContent;
        public Int32 beforeTime = 5;

        public String weekNo;
        public Int64 stopTime;
        public Boolean isStart;
        public Boolean isStop;
        public String nowTime;
        public MathItem_CaiPiao(String infoStr)
        {

            String[] infoArr = infoStr.Split(OddsUntil.SplitColumn);
            this.lotNumber = infoArr[0];
            this.no = infoArr[1];
            this.matchId = infoArr[2];
            this.matchTime = Convert.ToInt64(infoArr[3]) * 1000;
            this.leagueId = infoArr[4];
            this.leagueName = infoArr[5];
            this.leagueNameTr = infoArr[6];
            this.leagueNameEn = infoArr[7];
            this.leagueColor = infoArr[8];
            this.hostId = infoArr[9];
            this.visitId = infoArr[10];
            this.hostName = infoArr[11];
            this.visitName = infoArr[12];
            this.hostNameTr = infoArr[13];
            this.visitNameTr = infoArr[14];
            this.hostNameEn = infoArr[15];
            this.visitNameEn = infoArr[16];
            this.hostPos = infoArr[17];
            this.visitPos = infoArr[18];
            this.hostGoal = infoArr[19];
            this.visitGoal = infoArr[20];
            this.hand = infoArr[21];
            this.wins = infoArr[22];
            this.draws = infoArr[23];
            this.losses = infoArr[24];
            this.showOdds = infoArr[25];
            this.showAnalysis = infoArr[26];
            this.result = infoArr[27];
            this.finalSp = infoArr[28];
            this.isPause = infoArr[29];
            this.isJian = infoArr[30];
            this.closeTime = Convert.ToInt64(infoArr[31]) * 1000; 
            this.gameType = infoArr[32];
            //if(_lot.gameType==2 && infoArr[33]) this.hand = infoArr[33];
            if (infoArr[34] != null)
                this.anlContent = infoArr[34];

            this.weekNo = OddsUntil.getWeekNo(this.no);

            this.stopTime = this.closeTime - this.beforeTime * 60 * 1000;

            this.isStart = (this.matchTime < DateTime.Now.Ticks);

            this.isStop = (this.stopTime < DateTime.Now.Ticks);

            this.isStart = this.isStop;

            if (this.hostName != null && this.hostName.Length == 2)
                this.hostName = this.hostName.Insert(1, "　");

            if (this.visitName != null && this.visitName.Length == 2)
                this.visitName = this.hostName.Insert(1, "　");

            if (this.hostNameTr != null  && this.hostNameTr.Length == 2)
                this.hostNameTr = this.hostName.Insert(1, "　");

            if (this.visitNameTr != null  && this.visitNameTr.Length == 2)
                this.visitNameTr = this.hostName.Insert(1, "　");


        }

        public String getHand()
        {
            return "";
        }

        public String getHostName(String lang)
        {
            if (lang == "en")
                return this.hostNameEn;
            else if (lang == "tr")
                return this.hostNameTr;
            else
                return this.hostName;
        }

        public String getVisitName(String lang)
        {
            if (lang == "en")
                return this.visitNameEn;
            else if (lang == "tr")
                return this.visitNameTr;
            else
                return this.visitName;
        }

        public String getLeagueName(String lang)
        {
            if (lang == "en")
                return this.leagueNameEn;
            else if (lang == "tr")
                return this.leagueNameTr;
            else
                return this.leagueName;
        }
    }
}